﻿
namespace ExtensionMethods.Test.Extensions
{
    using System;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using FluentAssertions;
    using Groundwork.Extensions;

    [TestClass]
    public class NumericsTests
    {
        #region int
        [TestMethod]
        public void GreaterThanOrEqualIntTestBoundaryValueLessThan()
        {
            int value = 10;
            value.IsGreaterOrEqual(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualIntTestBoundaryValueGreaterThan()
        {
            int value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualIntTestBoundaryValueEqualTo()
        {
            int value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualIntTestBoundaryValueLessThan()
        {
            int value = 10;
            value.IsLessOrEqual(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualIntTestBoundaryValueGreaterThan()
        {
            int value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualIntTestBoundaryValueEqualTo()
        {
            int value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenIntTestBoundaryValueInside()
        {
            int value = 11;
            value.IsBetween(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenIntTestBoundaryValueOutsideMin()
        {
            int value = 9;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweenIntTestBoundaryValueOutsideMax()
        {
            int value = 16;
            value.IsBetween(10, 15).Should().BeFalse();
        }
        #endregion

        #region long
        [TestMethod]
        public void GreaterThanOrEqualLongTestBoundaryValueLessThan()
        {
            long value = 10;
            value.IsGreaterOrEqual(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualLongTestBoundaryValueGreaterThan()
        {
            long value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualLongTestBoundaryValueEqualTo()
        {
            long value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualLongTestBoundaryValueLessThan()
        {
            long value = 10;
            value.IsLessOrEqual(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualLongTestBoundaryValueGreaterThan()
        {
            long value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualLongTestBoundaryValueEqualTo()
        {
            long value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenlongTestBoundaryValueInside()
        {
            long value = 11;
            value.IsBetween(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenlongTestBoundaryValueOutsideMin()
        {
            long value = 9;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweenlongTestBoundaryValueOutsideMax()
        {
            long value = 16;
            value.IsBetween(10, 15).Should().BeFalse();
        }
        #endregion

        #region double
        [TestMethod]
        public void GreaterThanOrEqualDoubleTestBoundaryValueLessThan()
        {
            double value = 10;
            value.IsGreaterOrEqual(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualDoubleTestBoundaryValueGreaterThan()
        {
            double value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualDoubleTestBoundaryValueEqualTo()
        {
            double value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualdoubleTestBoundaryValueLessThan()
        {
            double value = 10;
            value.IsLessOrEqual(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualdoubleTestBoundaryValueGreaterThan()
        {
            double value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualdoubleTestBoundaryValueEqualTo()
        {
            double value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweendoubleTestBoundaryValueInside()
        {
            double value = 11;
            value.IsBetween(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweendoubleTestBoundaryValueOutsideMin()
        {
            double value = 9;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweendoubleTestBoundaryValueOutsideMax()
        {
            double value = 16;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        #endregion

        #region float
        [TestMethod]
        public void GreaterThanOrEqualFloatTestBoundaryValueLessThan()
        {
            float value = 10;
            value.IsGreaterOrEqual(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualFloatTestBoundaryValueGreaterThan()
        {
            float value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualFloatTestBoundaryValueEqualTo()
        {
            float value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualfloatTestBoundaryValueLessThan()
        {
            float value = 10;
            value.IsLessOrEqual(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualfloatTestBoundaryValueGreaterThan()
        {
            float value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualfloatTestBoundaryValueEqualTo()
        {
            float value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenfloatTestBoundaryValueInside()
        {
            float value = 11;
            value.IsBetween(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenfloatTestBoundaryValueOutsideMin()
        {
            float value = 9;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweenfloatTestBoundaryValueOutsideMax()
        {
            float value = 16;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        #endregion

        #region decimal
        [TestMethod]
        public void GreaterThanOrEqualDecimalTestBoundaryValueLessThan()
        {
            decimal value = 10;
            value.IsGreaterOrEqual(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualDecimalTestBoundaryValueGreaterThan()
        {
            decimal value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualDecimalTestBoundaryValueEqualTo()
        {
            decimal value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualdecimalTestBoundaryValueLessThan()
        {
            decimal value = 10;
            value.IsLessOrEqual(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualdecimalTestBoundaryValueGreaterThan()
        {
            decimal value = 10;
            value.IsGreaterOrEqual(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualdecimalTestBoundaryValueEqualTo()
        {
            decimal value = 10;
            value.IsGreaterOrEqual(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweendecimalTestBoundaryValueInside()
        {
            decimal value = 11;
            value.IsBetween(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweendecimalTestBoundaryValueOutsideMin()
        {
            decimal value = 9;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweendecimalTestBoundaryValueOutsideMax()
        {
            decimal value = 16;
            value.IsBetween(10, 15).Should().BeFalse();
        }

        #endregion

        #region short
        [TestMethod]
        public void GreaterThanOrEqualshortTestBoundaryValueLessThan()
        {
            short value = 10;
            value.IsGreaterOrEqual<short>(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualshortTestBoundaryValueGreaterThan()
        {
            short value = 10;
            value.IsGreaterOrEqual<short>(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualshortTestBoundaryValueEqualTo()
        {
            short value = 10;
            value.IsGreaterOrEqual<short>(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualshortTestBoundaryValueLessThan()
        {
            short value = 10;
            value.IsLessOrEqual<short>(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualshortTestBoundaryValueGreaterThan()
        {
            short value = 10;
            value.IsGreaterOrEqual<short>(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualshortTestBoundaryValueEqualTo()
        {
            short value = 10;
            value.IsGreaterOrEqual<short>(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenshortTestBoundaryValueInside()
        {
            short value = 11;
            value.IsBetween<short>(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenshortTestBoundaryValueOutsideMin()
        {
            short value = 9;
            value.IsBetween<short>(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweenshortTestBoundaryValueOutsideMax()
        {
            short value = 16;
            value.IsBetween<short>(10, 15).Should().BeFalse();
        }

        #endregion

        #region ushort
        [TestMethod]
        public void GreaterThanOrEqualushortTestBoundaryValueLessThan()
        {
            ushort value = 10;
            value.IsGreaterOrEqual<ushort>(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualushortTestBoundaryValueGreaterThan()
        {
            ushort value = 10;
            value.IsGreaterOrEqual<ushort>(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualushortTestBoundaryValueEqualTo()
        {
            ushort value = 10;
            value.IsGreaterOrEqual<ushort>(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualushortTestBoundaryValueLessThan()
        {
            ushort value = 10;
            value.IsLessOrEqual<ushort>(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualushortTestBoundaryValueGreaterThan()
        {
            ushort value = 10;
            value.IsGreaterOrEqual<ushort>(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualushortTestBoundaryValueEqualTo()
        {
            ushort value = 10;
            value.IsGreaterOrEqual<ushort>(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenushortTestBoundaryValueInside()
        {
            ushort value = 11;
            value.IsBetween<ushort>(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenushortTestBoundaryValueOutsideMin()
        {
            ushort value = 9;
            value.IsBetween<ushort>(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweenushortTestBoundaryValueOutsideMax()
        {
            ushort value = 16;
            value.IsBetween<ushort>(10, 15).Should().BeFalse();
        }
        #endregion

        #region uint
        [TestMethod]
        public void GreaterThanOrEqualuintTestBoundaryValueLessThan()
        {
            uint value = 10;
            value.IsGreaterOrEqual<uint>(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualuintTestBoundaryValueGreaterThan()
        {
            uint value = 10;
            value.IsGreaterOrEqual<uint>(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualuintTestBoundaryValueEqualTo()
        {
            uint value = 10;
            value.IsGreaterOrEqual<uint>(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualuintTestBoundaryValueLessThan()
        {
            uint value = 10;
            value.IsLessOrEqual<uint>(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualuintTestBoundaryValueGreaterThan()
        {
            uint value = 10;
            value.IsGreaterOrEqual<uint>(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualuintTestBoundaryValueEqualTo()
        {
            uint value = 10;
            value.IsGreaterOrEqual<uint>(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenuintTestBoundaryValueInside()
        {
            uint value = 11;
            value.IsBetween<uint>(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenuintTestBoundaryValueOutsideMin()
        {
            uint value = 9;
            value.IsBetween<uint>(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweenuintTestBoundaryValueOutsideMax()
        {
            uint value = 16;
            value.IsBetween<uint>(10, 15).Should().BeFalse();
        }
        #endregion

        #region ulong
        [TestMethod]
        public void GreaterThanOrEqualulongTestBoundaryValueLessThan()
        {
            ulong value = 10;
            value.IsGreaterOrEqual<ulong>(9).Should().BeTrue();
        }

        [TestMethod]
        public void GreaterThanOrEqualulongTestBoundaryValueGreaterThan()
        {
            ulong value = 10;
            value.IsGreaterOrEqual<ulong>(11).Should().BeFalse();
        }

        [TestMethod]
        public void GreaterThanOrEqualulongTestBoundaryValueEqualTo()
        {
            ulong value = 10;
            value.IsGreaterOrEqual<ulong>(10).Should().BeTrue();
        }

        [TestMethod]
        public void LessThanOrEqualulongTestBoundaryValueLessThan()
        {
            ulong value = 10;
            value.IsLessOrEqual<ulong>(9).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualulongTestBoundaryValueGreaterThan()
        {
            ulong value = 10;
            value.IsGreaterOrEqual<ulong>(11).Should().BeFalse();
        }

        [TestMethod]
        public void LessThanOrEqualulongTestBoundaryValueEqualTo()
        {
            ulong value = 10;
            value.IsGreaterOrEqual<ulong>(10).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenulongTestBoundaryValueInside()
        {
            ulong value = 11;
            value.IsBetween<ulong>(10, 15).Should().BeTrue();
        }

        [TestMethod]
        public void BetweenulongTestBoundaryValueOutsideMin()
        {
            ulong value = 9;
            value.IsBetween<ulong>(10, 15).Should().BeFalse();
        }

        [TestMethod]
        public void BetweenulongTestBoundaryValueOutsideMax()
        {
            ulong value = 16;
            value.IsBetween<ulong>(10, 15).Should().BeFalse();
        }
        #endregion



        [TestMethod]
        public void IsNumberDetection()
        {
            int intValue = 0;
            intValue.IsNumber().Should().BeTrue();

            long longValue = 0;
            longValue.IsNumber().Should().BeTrue();

            double doubleValue = 0;
            doubleValue.IsNumber().Should().BeTrue();

            float floatValue = 0;
            floatValue.IsNumber().Should().BeTrue();

            short shortValue = 0;
            shortValue.IsNumber().Should().BeTrue();

            ushort ushortValue = 0;
            ushortValue.IsNumber().Should().BeTrue();

            ulong ulongValue = 0;
            ulongValue.IsNumber().Should().BeTrue();

            uint uintValue = 0;
            uintValue.IsNumber().Should().BeTrue();

            decimal decimalValue = 0;
            decimalValue.IsNumber().Should().BeTrue();

            char charValue = 'a';
            charValue.IsNumber().Should().BeFalse();

            string stringValue = "a";
            stringValue.IsNumber().Should().BeFalse();
        }

    }
}
